package ru.averta.notes.service.search;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.Reader;

/**
 * <code>LanguageDetectService</code>
 *
 * @author: fedor.belov (fedor.belov@mail.ru)
 * Date: 26.05.11 21:43
 */
public interface LanguageDetectService {

    public Language detect(String source);
    public Language detect(Reader source);

    public enum Language {
        RU, EN;

        private static final Logger logger = LoggerFactory.getLogger(Language.class);

        public static Language myValueOf(String title) {
            try {
                return valueOf(title.toUpperCase());
            } catch (Exception e) {
                logger.info("Попытка преобразовать в неверный формат - " + title);
                return null;
            }
        }


    }

}
